package cn.maihe.elg.operation.repository.entity;

import cn.maihe.elg.operation.repository.entity.DecryptNoticeMsgVo;
import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 解密短信通知表
 */
@TableName("t_decrypt_notice_msg")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.DecryptNoticeMsgMapper")
public class DecryptNoticeMsg extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 受理订单主键
     */
    @TableField(value = "accept_order_id")
    private Long acceptOrderId;

    /**
     * 受理订单号
     */
    @TableField(value = "accept_order_no")
    private String acceptOrderNo;

    @TableField(value = "bid_indate")
    private Date bidIndate;

    @TableField(value = "bid_open_time")
    private Date bidOpenTime;

    /**
     * 通知次数
     */
    @TableField(value = "decrypt_notice_times")
    private Integer decryptNoticeTimes;

    /**
     * 触发解密通知时间
     */
    @TableField(value = "decrypt_notice_date")
    private Date decryptNoticeDate;

    /**
     * 项目名称
     */
    @TableField(value = "project_name")
    private String projectName;

    /**
     * 标段名称
     */
    @TableField(value = "section_name")
    private String sectionName;

    /**
     * 投标人
     */
    @TableField(value = "bidder_name")
    private String bidderName;

    /**
     * 投标公司联系人电话
     */
    @TableField(value = "bidder_contact_tel")
    private String bidderContactTel;

    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    public DecryptNoticeMsgVo buildVo() {
        return new DecryptNoticeMsgVo(id, acceptOrderId, acceptOrderNo, bidIndate, bidOpenTime, decryptNoticeTimes, decryptNoticeDate, projectName, sectionName, bidderName, bidderContactTel, gmtCreate, gmtModified, userCreate, userModified);
    }

    public static DecryptNoticeMsg of(DecryptNoticeMsgVo vo) {
        return new DecryptNoticeMsg(vo.getId(), vo.getAcceptOrderId(), vo.getAcceptOrderNo(), vo.getBidIndate(), vo.getBidOpenTime(), vo.getDecryptNoticeTimes(), vo.getDecryptNoticeDate(), vo.getProjectName(), vo.getSectionName(), vo.getBidderName(), vo.getBidderContactTel(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified());
    }
}